<template>
  <div style="width: 100%;height: 100%">
    <el-form>
      <el-form-item>
        <el-input type="textarea"
               :autosize="{ minRows: 2, maxRows: 4}"
               style="width: 100%"
               placeholder="有话要说"
               v-model="text">
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="update">确认修改</el-button>
      </el-form-item>
    </el-form>
  </div>

</template>

<script>
import {update_16221} from "../../api";

export default {
  name: "Update_text_default",
  props:{
    text:""
  },
  methods:{
    update(){
      const _this=this
      if(_this.text==""||_this.text==null){
        _this.$message({
          type: 'error',
          message: '内容不能为空'
        });
      }else {
        var body={
          uId:sessionStorage.getItem("uId"),
          tId:sessionStorage.getItem("up_tId"),
          gId:sessionStorage.getItem("up_gId"),
          tText:this.text
        }
        update_16221(body).then(resp=>{
          if(resp.code>0) {
            _this.$message({
              type: 'success',
              message: '修改成功'
            });
          }
            else{
              _this.$message({
                type: 'error',
                message: '修改失败：'+resp.note
              });
            }
        }).catch(err=>{
          _this.$message({
            type: 'error',
            message: '调用接口失败:'+err
          });
        })
      }


    }
  }
}
</script>

<style scoped>

</style>